package example09;
class Student{
    private String name;
    private int age;
    //定义构造法
    public Student(String name,int age){
        name = name;
        age =age;
    }
    public String read(){
        return "我是："+name+",年龄："+age;
    }
}
public class Example09 {
    public static void main(String[] args) {
        Student stu = new Student("张三",18);
        System.out.println(stu.read());
    }
}
package example10;
class Student10{
    private String name;
    private int age;
    //定义构造方法
    public Student10(String name,int age){
        this.name = name;
        this.age = age;
    }
    public String read() {
        return  "大家好，我是" + name + ",年龄" + age;
    }

}



public class Example10 {
    public static void main(String[] args) {
        Student10 stu = new Student10("张三", 18);

        System.out.println(stu.read());
    }
}
package example11;
class Student11{
    private String name;
    private int age;
    public Student11(){
        System.out.println("实例化了一个新的student对象");
    }
    public Student11 (String name,int age){
        this();
        this.name = name;
    }
    public String read(){
        return "我是："+ name +",年龄："+age;
    }
}

public class example11 {
    public static void main(String[] args) {
        Student11 stu = new Student11("张三", 18);
        System.out.println(stu.read());
    }
}
package example11;
class Student11{
    private String name;
    private int age;
    public Student11(){
        System.out.println("实例化了一个新的student对象");
    }
    public Student11 (String name,int age){
        this();
        this.name = name;
    }
    public String read(){
        return "我是："+ name +",年龄："+age;
    }
}

public class example11 {
    public static void main(String[] args) {
        Student11 stu = new Student11("张三", 18);
        System.out.println(stu.read());
    }
}
package example13;
class Student {
    String name;
    int age;
    String school = "A大学";
    public Student(String name,int age){
        this.name =name;
        this.age = age;
    }
    public void info(){
        System.out.println("姓名："+ this.name+",年龄："+this.age+",学校："+school);
    }
}
public class Example13 {
    public static void main(String[] args) {
        Student stu1 = new Student("张三",18);
        Student stu2 = new Student("李四",19);
        Student stu3 = new Student("王五",20);
        stu1.info();
        stu2.info();
        stu3.info();
    }
}
package example14;
class Student{
    String name;
    int age;
    static String school ="A大学";
    public Student(String name,int age){
        this.name=name;
        this.age=age;
    }
    public void info(){
        System.out.println("姓名："+this.name+",年龄："+this.age+",学校："+school);
    }
}
public class Example14 {
    public static void main(String[] args) {
        Student stu1 = new Student("张三", 18);
        Student stu2 = new Student("李四", 19);
        Student stu3 = new Student("王五", 20);
        stu1.info();
        stu2.info();
        stu3.info();
        stu1.school = "B大学";
        stu1.info();
        stu2.info();
        stu3.info();
    }
}
    ackage example15;
class Student15{
    private String name;
    private int age;
    private static String school = "a 大学";

    public Student15(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void info() {
        System.out.println("姓名：" + this.name + ",年龄：" + this.age + "，学院" + school);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public static String getSchool() {
        return school;
    }

    public static void setSchool(String school) {
        Student15.school = school;
    }
}
public class Example16 {
    public static void main(String[] args) {
        Student15 stu1 = new Student15("张三", 18);
        Student15 stu2 = new Student15("李四", 19);
        Student15 stu3 = new Student15("王五", 20);
        stu1.setAge(20);
        stu2.setName("小明");
        Student15.setSchool("b 大学");
        stu1.info();
        stu2.info();
        stu3.info();
    }
}
